<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<style type="text/css">

body{ background:#EEEEEE;margin:0; padding:0; font-family:"微软雅黑", Arial, Helvetica, sans-serif; }

a{ color:#006600; text-decoration:none;}

a:hover{color:#990000;}

.top{ margin:5px auto; color:#990000; text-align:center;}

.info select{ border:1px #993300 solid; background:#FFFFFF;}

.info{ margin:5px; text-align:center;}

.info #show{ color:#3399FF; }

.bottom{ text-align:right; font-size:12px; color:#CCCCCC; width:1000px;}

</style>

</head>

<body>
<link rel="stylesheet" href="__PUBLIC__/css/pintuer.css">
<link rel="stylesheet" href="__PUBLIC__/css/admin.css">
<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/pintuer.js"></script>
</head>
<body>
<form method="post" action="" id="listform">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li>
          <select id="s_province" name="s_province" class="input" onchange="changesearch()" style="width:100px; line-height:17px; display:inline-block"> 
          </select>
          &nbsp;&nbsp;
          <select id="s_city" name="s_city"  class="input" onchange="changesearch()"  style="width:100px; line-height:17px;display:inline-block">
          </select>
          &nbsp;&nbsp
          <select id="s_county" name="s_county" class="input" change="changesearch()"  style="width:100px; line-height:17px;display:inline-block">
          </select>
        </li>
        <li>
          <input type="text" placeholder="请输入搜索关键字" id="keywords" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" id="sousuo" class="button border-main icon-search" > 搜索</a></li>
        <script>
            $("#sousuo").click(function(){
                var keyword = $("#keywords").val();
                function timetrans(date){
                    var date = new Date(date*1000);//如果date为13位不需要乘1000
                    var Y = date.getFullYear() + '-';
                    var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
                    var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
                    var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
                    var m = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
                    var s = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds());
                    return Y+M+D+h+m+s;
                }
                $.ajax({
                    type:'POST',
                    dataType:'json',
                    url: '__CONTROLLER__/sachi',
                    data:{keyword:keyword},
                    success:function (data) {
                        $("#tbody").empty();
                        var tr='';
                        for(var i=0; i<data.length;i++){
                            var html4=timetrans(data[i].addtime)
                            var html5=timetrans(data[i].shtime)
                            if(data[i].isshow==0){
                                var html1='<font color="#00CC99">未审核</font>'
                            }else{
                                var html1='<font color="#00CC99">已审核</font>'
                            }
                            var id=data[i].id
                            var zcid=data[i].zcid
                            var html3='<a href="__MODULE__/Dcom/zczz?zcid=zcid"><font color="red">查看注册资质</font></a>'
                            var html6='<a class="button border-main" href="__MODULE__/Dcom/update?id='+data[i].id+'"><span class="icon-edit"></span>修改</a><a class="button border-red" href="javascript:void(0)" onclick="del('+id+')"><span class="icon-trash-o"></span>删除</a>'
                            var url = '<img src="__PUBLIC__/Upload/'+data[i].imagename+'" alt="" width="70" height="50" >'
                            tr+='<tr><td style="text-align:center;padding-left:20px;">'+data[i].id+'</td><td>'+data[i].username+'</td>' +
                                '<td>'+data[i].cname+'</td><td>'+data[i].lianxiren+'</td><td>'+data[i].mobile+'</td><td>'+data[i].email+'</td><td>'+html3+'</td><td>'+url+'</td><td>'+data[i].dizhi+'</td><td>'+data[i].operator+'</td> <td>'+html4+'</td><td>'+html1+'</td><td><div class="button-group">'+html6+'</div></td> </tr>;'
                        }
                        $('#tbody').append(tr);//追加到你需要放在的位置
                    }
                });
            })
        </script>
        <script class="resources library" src="__PUBLIC__/area.js" type="text/javascript"></script>
    <script type="text/javascript">_init_area();</script>
     <div id="show"></div>
      </ul>
      <script type="text/javascript">
          var Gid  = document.getElementById ;
          var showArea = function(){
              Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +
                  Gid('s_city').value + " - 县/区" +
                  Gid('s_county').value + "</h3>"
          }
          $("#s_county").change(function (){
              function timetrans(date){
                  var date = new Date(date*1000);//如果date为13位不需要乘1000
                  var Y = date.getFullYear() + '-';
                  var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
                  var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
                  var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
                  var m = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
                  var s = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds());
                  return Y+M+D+h+m+s;
              }
              var s_county = $('#s_county').val();
              console.log(s_county)
              $.ajax({
                  type: 'POST',
                  dataType: 'json',
                  url: '__CONTROLLER__/seachs',
                  data:{s_county:s_county},
                  success:function (data) {
                      $("#tbody").empty();
                      var tr='';
                      for(var i=0; i<data.length;i++){
                          var html4=timetrans(data[i].addtime)
                          var html5=timetrans(data[i].shtime)
                          if(data[i].isshow==0){
                              var html1='<font color="#00CC99">未审核</font>'
                          }else{
                              var html1='<font color="#00CC99">已审核</font>'
                          }
                          var id=data[i].id
                          var zcid=data[i].zcid
                          var html3='<a href="__MODULE__/Dcom/zczz?zcid=zcid"><font color="red">查看注册资质</font></a>'
                          var html6='<a class="button border-main" href="__MODULE__/Dcom/update?id='+data[i].id+'"><span class="icon-edit"></span>修改</a><a class="button border-red" href="javascript:void(0)" onclick="del('+id+')"><span class="icon-trash-o"></span>删除</a>'
                          var url = '<img src="__PUBLIC__/Upload/'+data[i].imagename+'" alt="" width="70" height="50" >'
                          tr+='<tr><td style="text-align:center;padding-left:20px;">'+data[i].id+'</td><td>'+data[i].username+'</td>' +
                              '<td>'+data[i].cname+'</td><td>'+data[i].lianxiren+'</td><td>'+data[i].mobile+'</td><td>'+data[i].email+'</td><td>'+html3+'</td><td>'+url+'</td><td>'+data[i].dizhi+'</td><td>'+data[i].operator+'</td> <td>'+html4+'</td><td>'+html1+'</td><td><div class="button-group">'+html6+'</div></td> </tr>;'
                      }
                      $('#tbody').append(tr);//追加到你需要放在的位置
                  }
              });
          })
      </script>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th>ID</th>
        <th>账号</th>
        <th>公司名称</th>
        <th>联系人</th>
        <th>电话</th>
        <th>邮箱</th>
		<th>工商注册信息</th>
        <th>Logo</th>
        <th>公司地址</th>
        <th>操作员</th>
        <th>添加时间</th>
        <th>审核状态</th>
        <th>操作</th>
      </tr>
      <div name="list" id="vo">
        <tbody id="tbody">
      <foreach name="arr" item="v">
        <tr id="res">
          <td>{$v.id}</td>
		  <td>{$v.username}</td>
          <td><font color="red">{$v.cname}</font></td>
          <td>{$v.lianxiren}</td>
          <td>{$v.mobile}</td>
          <td>{$v.email}</td>
          <td><a href="__MODULE__/Dcom/zczz?zcid={$v.zcid}"><font color="red">查看注册资质</font></a></td>
          <td width="10%"><img src="__PUBLIC__/Upload/{$v.imagename}" alt="" width="70" height="50" /></td>
          <td>{$v.dizhi}</td>
          <td><font color="#00CC99">{$v.operator}</font></td>
          <td><?php echo date("Y-m-d H:i:s",$v["addtime"])?></td>
 		  <td><font color="#00CC99">{$v["isshow"]==1?"已审核":"未审核"}</font></td>
          <td><div class="button-group">
            <?php if($_SESSION['status']==1){?>
            <a class="button border-main" href="<?=U("Dcom/update",array('id'=>$v['id']));?>"><span class="icon-edit"></span> 修改</a>
            <a class="button border-red" href="javascript:void(0)" onclick="del(<?php echo $v['id']?>)"><span class="icon-trash-o"></span>删除</a>
            <?php }else{ ?>
          <td>你无权操作</td>
          <?php }?>
      </div></td>
        </tr>
        </foreach>
      </tbody>
      <tr>
        <td colspan="13"><div class="pagelist">{$pageStr}</div></td>
      </tr>
      </div>
    </table>
  </div>
</form>
<script type="text/javascript">
//单个删除
function del(id){
	var title = window.confirm('您确定要删除此条数据么？')
    console.log(id)
	if(title){
		$.ajax({
			type:'post',
			url:'{:U("Dcom/del")}',
			data:{id:id},
			dataType:"json",
			success:function(){

			window.location.reload()
			}
		})
	}else{

	}
}
</script>
</body>
</html>